home *** CD-ROM | disk | FTP | other *** search
File List | 1989-10-19 | 13.7 KB | 648 lines |
- '
- ' GEM GRAPHIC PROCEDURES FOR GDOS
- ' by Jim Burton
- ' COPYRIGHT 1990 ANTIC PUBLISHING
- '
- ' CONTROL FUNCTIONS
- '
- Procedure Openwork(Device%)
- '
- ' Opens the device workstation for output.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,11
- Dpoke Intin,Device%
- Dpoke Intin+20,2
- Vdisys 1
- Handle%=Dpeek(Contrl+12) ! the device's handle
- If Handle%=0
- Alert 1,"GDOS not responding.|Aborting",1,"OK",Dummy%
- End
- Endif
- Devicewidth%=Dpeek(Intout)
- Deviceheight%=Dpeek(Intout+2)
- Return
- '
- Procedure Printwork(Handle%)
- '
- ' Causes the graphics subroutines performed on the workstation
- ' to be printed out.
- '
- Dpoke Contrl+12,Handle%
- Vdisys 4
- Return
- '
- Procedure Closework(Handle%)
- '
- ' Closes the workstation.
- '
- Dpoke Contrl+12,Handle%
- Vdisys 2
- Return
- '
- Procedure Loadfont(Handle%,Select%)
- '
- ' Loads the fonts listed in ASSIGN.SYS after the printer driver file.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Select%
- Vdisys 119
- Return
- '
- Procedure Unloadfont(Handle%,Select%)
- '
- ' Frees the memory taken by the fonts.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Select%
- Vdisys 120
- Return
- '
- Procedure Clip(Handle%,Flag%,X1%,Y1%,X2%,Y2%)
- '
- ' Confines the following graphic output to the points within the
- ' rectangle described by X1%,Y1% to X2%,Y2%.
- ' Flag% determines if the clipping is on or off.
- ' (0 is off, 1 is on)
- '
- Dpoke Contrl+2,2
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Flag%
- Dpoke Ptsin,X1%
- Dpoke Ptsin+2,Y1%
- Dpoke Ptsin+4,X2%
- Dpoke Ptsin+6,Y2%
- Vdisys 129
- Return
- '
- Procedure Newpage(Handle%)
- '
- ' For the printer, causes a form-feed.
- '
- Dpoke Contrl+12,Handle%
- Vdisys 3
- Return
- '
- ' ATTRIBUTE FUNCTIONS
- '
- Procedure Set_writemode(Handle%,Mode%)
- '
- ' Sets the writing mode.
- ' If Mode% = 1 Replace mode (normal)
- ' If Mode% = 2 Transparent
- ' If mode% = 3 Exclusive-Or
- ' If mode% = 4 Reverse Transparent
- '
- ' NOTE: See BASIC's GRAPHMODE command
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Mode%
- Vdisys 32
- Return
- '
- Procedure Set_fillcol(Handle%,Col%)
- '
- ' Sets the fill color. (for printers, 1 or 0)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Col%
- Vdisys 25
- Return
- '
- Procedure Set_fillbord(Handle%,Flag%)
- '
- ' Flag% determines if the filled object's border is shown.
- ' If Flag% = 0 the border is not shown.
- ' If Flag% = 1 the border is shown.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Flag%
- Vdisys 104
- Return
- '
- Procedure Set_fillstyle(Handle%,Style%)
- '
- ' Sets the fill pattern style.
- '
- ' NOTE: See BASIC's DEFFILL command
- ' (If style%=4, the user-defined pattern is selected. See Set_userfill.)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Style%
- Vdisys 23
- Return
- '
- Procedure Set_fillindex(Handle%,Index%)
- '
- ' Sets the fill pattern.
- '
- ' NOTE: See BASIC's DEFFILL command
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Index%
- Vdisys 24
- Return
- '
- Procedure Set_linecol(Handle%,Col%)
- '
- ' Sets the polyline line color. (for printers, 1 or 0)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Col%
- Vdisys 17
- Return
- '
- Procedure Set_linetype(Handle%,Type%)
- '
- ' Sets the polyline type.
- '
- ' If Type% = 0 Line is blank.
- ' If Type% = 1 ------------------------------------------------
- ' If Type% = 2 ------------ ------------ ------------
- ' If Type% = 3 --- --- --- --- --- ---
- ' If Type% = 4 ------- --- ------- --- ------- ---
- ' If Type% = 5 -------- -------- --------
- ' If Type% = 6 ---- -- -- ---- -- -- ---- -- --
- ' If Type% = 7 Use user-defined line.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Type%
- Vdisys 15
- Return
- '
- Procedure Set_linewid(Handle%,Width%)
- '
- ' Sets the polyline's width.
- ' (Width% can be from 1 to 39, odd numbers only)
- '
- Dpoke Contrl+2,1
- Dpoke Contrl+6,0
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,Width%
- Dpoke Ptsin+2,0
- Vdisys 16
- Return
- '
- Procedure Set_charabs(Handle%,Height%)
- '
- ' Sets the absolute height of the characters.
- ' (This doesn't seem to work with GDOS v1.2. It may work with later versions.)
- '
- Dpoke Contrl+2,1
- Dpoke Contrl+6,0
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,0
- Dpoke Ptsin+2,Height%
- Vdisys 12
- Return
- '
- Procedure Set_charpoint(Handle%,Height%)
- '
- ' Sets the height of the characters in points (1/72 inch).
- ' (This doesn't seem to work with GDOS v1.2. It may work with later versions.)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Height%
- Vdisys 107
- Return
- '
- Procedure Set_charvector(Handle%,Angle%)
- '
- ' Sets the baseline angle of the text.
- ' Angle% is in degrees * 10 (3600 = 360 degrees)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Angle%
- Vdisys 13
- Return
- '
- Procedure Set_font(Handle%,Font%)
- '
- ' Sets the font to be printed.
- ' (Again, this doesn't seem to work properly with GDOS 1.2)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Font%
- Vdisys 21
- Return
- '
- Procedure Set_charcol(Handle%,Col%)
- '
- ' Sets the color of the text to be printed.
- ' (For printers, 0 or 1)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Col%
- Vdisys 22
- Return
- '
- Procedure Set_textalign(Handle%,Horz%,Vert%)
- '
- ' Sets the text alignment.
- ' Horz% = 0 left
- ' = 1 centered
- ' = 2 right
- '
- ' Vert% = 0 baseline
- ' = 1 half line
- ' = 2 ascent line
- ' = 3 bottom line
- ' = 4 descent line
- ' = 5 top line
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,2
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Horz%
- Dpoke Intin+2,Vert%
- Vdisys 39
- Return
- '
- Procedure Set_chareffect(Handle%,Effect%)
- '
- ' Sets the special effect to be used while printing.
- '
- ' NOTE: See BASIC's DEFTEXT command
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Effect%
- Vdisys 106
- Return
- '
- Procedure Set_userline(Handle%,Pattern%)
- '
- ' Sets a user-defined line pattern.
- ' Pattern% is a 2-byte bit map of the line.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Pattern%
- Vdisys 113
- Return
- '
- Procedure Set_endstyle(Handle%,Begin%,End%)
- '
- ' Sets the begining and ending polyline styles.
- '
- ' Begin% or End% can contain the following values:
- ' 0 = square.
- ' 1 = arrow.
- ' 2 = round.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,2
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Begin%
- Dpoke Intin+2,End%
- Vdisys 108
- Return
- '
- Procedure Set_polymark(Handle%,Symbol%)
- '
- ' Sets the polymarker style.
- '
- ' Symbol% can contain the following values:
- ' 1 = point.
- ' 2 = plus sign.
- ' 3 = star.
- ' 4 = square.
- ' 5 = diagonal cross.
- ' 6 = diamond.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Symbol%
- Vdisys 18
- Return
- '
- Procedure Set_polyheight(Handle%,Height%)
- '
- ' Sets the polymarker height.
- '
- Dpoke Contrl+2,1
- Dpoke Contrl+6,0
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,0
- Dpoke Ptsin+2,Height%
- Vdisys 19
- Return
- '
- Procedure Set_markcol(Handle%,Col%)
- '
- ' Sets the polymarker color.
- ' (For printers, 0 or 1)
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Col%
- Vdisys 20
- Return
- '
- Procedure Set_userfill(Handle%,Loc%)
- '
- ' Sets the user-defined fill pattern.
- ' Loc% points to a 32-byte string which
- ' contains the bit-image data.
- '
- Dpoke Contrl+2,0
- Dpoke Contrl+6,16
- Dpoke Contrl+12,Handle%
- Bmove Loc%,Intin,32
- Vdisys 112
- Return
- '
- ' GRAPHIC FUNCTIONS
- '
- Procedure Fillpoly(Handle%,Top%)
- '
- ' Draws a filled-in polyline.
- '
- ' NOTE:
- ' Before calling this procedure, you must define an array
- ' Tempx%() containing all of the X coordinates in the polyline.
- ' (no more than 126 coordinates are allowed)
- ' You must do the same for the Y coordinates in Tempy%().
- ' Top% is the number of coordinate pairs.
- '
- Dpoke Contrl+2,Top%+1 ! number of points in polyline
- Dpoke Contrl+6,0
- Dpoke Contrl+12,Handle%
- For K%=0 To Top%
- Dpoke Ptsin+(K%*4),Tempx%(K%)
- Dpoke Ptsin+(K%*4)+2,Tempy%(K%)
- Next K%
- Vdisys 9
- Return
- '
- Procedure Drawpoly(Handle%,Top%)
- '
- ' Draws a polyline.
- '
- ' NOTE: See procedure FILLPOLY above.
- '
- Dpoke Contrl+2,Top%+1 ! number of points in the polyline
- Dpoke Contrl+6,0
- Dpoke Contrl+12,Handle%
- For K%=0 To Top%
- Dpoke Ptsin+(K%*4),Tempx%(K%)
- Dpoke Ptsin+(K%*4)+2,Tempy%(K%)
- Next K%
- Vdisys 6
- Return
- '
- Procedure Markpoly(Handle%,Top%)
- '
- ' Draws endpoints of a polyline.
- '
- ' NOTE: See procedure FILLPOLY above.
- '
- Dpoke Contrl+2,Top%+1 ! number of points in the polyline
- Dpoke Contrl+6,0
- Dpoke Contrl+12,Handle%
- For K%=0 To Top%
- Dpoke Ptsin+(K%*4),Tempx%(K%)
- Dpoke Ptsin+(K%*4)+2,Tempy%(K%)
- Next K%
- Vdisys 7
- Return
- '
- Procedure Drawcircle(Handle%,Cx%,Cy%,Rad%)
- '
- ' Draws a circle.
- '
- Dpoke Contrl+2,3
- Dpoke Contrl+6,0
- Dpoke Contrl+10,4
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,Cx%
- Dpoke Ptsin+2,Cy%
- Dpoke Ptsin+8,Rad%
- Vdisys 11
- Return
- '
- Procedure Drawarc(Handle%,Cx%,Cy%,Rad%,Ba%,Ea%)
- '
- ' Draws an arc.
- ' Ba% and Ea% are the beginning and ending angles of the arc
- ' in degrees times 10. (360 degrees = 3600)
- '
- Dpoke Contrl+2,4
- Dpoke Contrl+6,2
- Dpoke Contrl+10,2
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Ba%
- Dpoke Intin+2,Ea%
- Dpoke Ptsin,Cx%
- Dpoke Ptsin+2,Cy%
- Dpoke Ptsin+12,Rad%
- Vdisys 11
- Return
- '
- Procedure Drawpie(Handle%,Cx%,Cy%,Rad%,Ba%,Ea%)
- '
- ' Draws a piece of pie, like a pie chart.
- '
- Dpoke Contrl+2,4
- Dpoke Contrl+6,2
- Dpoke Contrl+10,3
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Ba%
- Dpoke Intin+2,Ea%
- Dpoke Ptsin,Cx%
- Dpoke Ptsin+2,Cy%
- Dpoke Ptsin+12,Rad%
- Vdisys 11
- Return
- '
- Procedure Drawellarc(Handle%,Cx%,Cy%,Xrad%,Yrad%,Ba%,Ea%)
- '
- ' Draws an elliptical arc.
- ' Xrad% and Yrad% are the X radius and the Y radius of the arc.
- '
- Dpoke Contrl+2,2
- Dpoke Contrl+6,2
- Dpoke Contrl+10,6
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Ba%
- Dpoke Intin+2,Ea%
- Dpoke Ptsin,Cx%
- Dpoke Ptsin+2,Cy%
- Dpoke Ptsin+4,Xrad%
- Dpoke Ptsin+6,Yrad%
- Vdisys 11
- Return
- '
- Procedure Drawellpie(Handle%,Cx%,Cy%,Xrad%,Yrad%,Ba%,Ea%)
- '
- ' Draws an elliptical pie.
- '
- Dpoke Contrl+2,2
- Dpoke Contrl+6,2
- Dpoke Contrl+10,7
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Ba%
- Dpoke Intin+2,Ea%
- Dpoke Ptsin,Cx%
- Dpoke Ptsin+2,Cy%
- Dpoke Ptsin+4,Xrad%
- Dpoke Ptsin+6,Yrad%
- Vdisys 11
- Return
- '
- Procedure Drawellipse(Handle%,Cx%,Cy%,Xrad%,Yrad%)
- '
- ' Draws an ellipse.
- '
- Dpoke Contrl+2,2
- Dpoke Contrl+6,0
- Dpoke Contrl+10,5
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,Cx%
- Dpoke Ptsin+2,Cy%
- Dpoke Ptsin+4,Xrad%
- Dpoke Ptsin+6,Yrad%
- Vdisys 11
- Return
- '
- Procedure Drawroundrect(Handle%,X1%,Y1%,X2%,Y2%)
- '
- ' Draws a rectangle with rounded corners.
- '
- Dpoke Contrl+2,2
- Dpoke Contrl+6,0
- Dpoke Contrl+10,8
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,X1%
- Dpoke Ptsin+2,Y1%
- Dpoke Ptsin+4,X2%
- Dpoke Ptsin+6,Y2%
- Vdisys 11
- Return
- '
- Procedure Fillroundrect(Handle%,X1%,Y1%,X2%,Y2%)
- '
- ' Draws a filled rectangle with rounded corners.
- '
- Dpoke Contrl+2,2
- Dpoke Contrl+6,0
- Dpoke Contrl+10,9
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,X1%
- Dpoke Ptsin+2,Y1%
- Dpoke Ptsin+4,X2%
- Dpoke Ptsin+6,Y2%
- Vdisys 11
- Return
- '
- Procedure Fillrect(Handle%,X1%,Y1%,X2%,Y2%)
- '
- ' Draws a filled rectangle.
- '
- Dpoke Contrl+2,2
- Dpoke Contrl+6,0
- Dpoke Contrl+12,Handle%
- Dpoke Ptsin,X1%
- Dpoke Ptsin+2,Y1%
- Dpoke Ptsin+4,X2%
- Dpoke Ptsin+6,Y2%
- Vdisys 114
- Return
- '
- Procedure Drawfill(Handle%,X%,Y%,Index%)
- '
- ' Performs a contour fill, which starts at X%,Y% and stops when
- ' the color Index% is reached.
- '
- Dpoke Contrl+2,1
- Dpoke Contrl+6,1
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Index%
- Dpoke Ptsin,X%
- Dpoke Ptsin+2,Y%
- Vdisys 103
- Return
- '
- Procedure Justtext(Handle%,X%,Y%,Loc%,Length%,Word%,Char%)
- '
- ' Prints justified text at coordinates X%,Y%
- '
- ' Length% is the number of pixels the text should extend.
- ' If Word% is set to 1, the space between words is adjusted so
- ' that the text is justified.
- ' If Char% is set to 1, the space between characters is adjusted.
- ' Loc% points to the text string.
- '
- Dpoke Contrl+2,2
- Dpoke Ptsin,X%
- Dpoke Ptsin+2,Y%
- Dpoke Ptsin+4,Length%
- Kount%=0
- Stringloc%=Intin+4
- Do
- Char%=Peek(Loc%+Kount%)
- Dpoke Stringloc%+(Kount%*2),Char%
- Inc Kount%
- Exit If Char%=0
- Loop
- Dpoke Contrl+6,Kount%+2
- Dpoke Contrl+10,10
- Dpoke Contrl+12,Handle%
- Dpoke Intin,Word%
- Dpoke Intin+2,Char%
- Vdisys 11
- Return
- '
- Procedure Drawtext(Handle%,X%,Y%,Loc%)
- '
- ' Prints text at coordinates X%, Y%.
- '
- ' Loc% points to the text string.
- '
- Dpoke Contrl+2,1
- Dpoke Ptsin,X%
- Dpoke Ptsin+2,Y%
- Kount%=0
- Do
- Char%=Peek(Loc%+Kount%)
- Dpoke Intin+(Kount%*2),Char%
- Inc Kount%
- Exit If Char%=0
- Loop
- Dpoke Contrl+6,Kount%
- Dpoke Contrl+12,Handle%
- Vdisys 8
- Return
- '
-